﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="../style.css">
<link href="../tablecloth/tablecloth.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="../tablecloth/tablecloth.js"></script>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>

<?php	

	include("../inc/joomlaInt_admin.php");
	include("../inc/inc_configuration.php");
	
	
if ($jUser==0)
{
	echo "Bitte zuerst einloggen!";
}
else
{
	
	$q="SELECT gid FROM $tbl_users WHERE id=$jUser";
					$qe=mysql_query($q);
					$qeo=mysql_fetch_object($qe);
					
					$gid=$qeo->gid;
					
					if ($gid!=$admingroup)
					{
						echo "Du bist kein Admin!";
						break;
					}
					
	$season=$_GET["season"];
	
	$_SESSION["season"] = $season;

	
		
	$q = "	SELECT 
				l.id AS id,
				l.name AS name,
				l.type
			FROM
				$tbl_leagues l
			WHERE
				l.seasonId=$season";
				
	$qe = mysql_query($q);
	
	$c = mysql_num_rows($qe);
	
	if ($c>0)
	{
		echo "	<table>
			<tr>
				<th>id</th>
				<th>Name</th>
				<th>Typ</th>
				<th></th>
			</tr>
			";
			
		while ($row=mysql_fetch_object($qe))
		{
			$type=$row->type;
			
			if ($type==1) {$tb="Liga"; $link="liga.php";} else {
			if ($type==2) {$tb="International"; $link="liga_international.php";} else {
			if ($type==3) {$tb="Pokal"; $link="liga_international.php";}}}
			
			echo "	<tr>
						<td>",$row->id,"</td>
						<td><a href='",$link,"?liga=",$row->id,"'>",$row->name,"</a></td>
						<td>",$tb,"</td>
						<td><a href='liga_entfernen.php?liga=",$row->id,"' class='minibutton entfernen'></a></td></tr>
					</tr>";
		}
	}
	else
	{
		echo"Es wurden noch keine Ligen angelegt.";
	}
	
	if ($c>0)
	{
		echo "</table>";
	}
	
	echo "<br><br>
			<center><a href='liga_anlegen.php' class='button anlegen'>Liga anlegen</a></center>
		  <br><br>
			<center><a href='saison_verwaltung.php' class='button zurueck'>Zurück</a></center>";

}

?>

</body>
</html>